function startup() {
}

function preload() {
}

function load() {
  GoogleMail.load();
}

function error() {
}

function shutdown() {
  GoogleMail.shutdown();
}

function dropFiles(uris) {
}

var GoogleMail = {
  _timer : null,
  _newMailCount : 0,

  _doTimer : function() {
    // simple check uses the window title to check for new mail
    var title = document.title;
    var matches = title.match(/Inbox \((\d+)\)/);
    if (matches) {
      if (matches[1] > this._newMailCount) {
        window.platform.showNotification("GMail", "You have new email. There are " + matches[1] + " unread email in your Inbox.", null);
      }

      this._newMailCount = matches[1];
    }
  },

  load : function() {
    // kick off a polling timer to check for new mail
    this._timer = window.platform.setInterval(GoogleMail._doTimer, 5000);
  },

  shutdown : function() {
    if (this._timer)
      window.platform.clearInterval(this._timer);
  }
};
